package com.example.test_demo.ali;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class Test {
	public static void main(String[] args) {

		String[] a = {"192.168.1.110","10.192.2.4","1.192.2.4","10.19.22.4","10.20.22.4","10.20.22.5","10.20.2.24","10.50.2.3","202.234.100.68"};

		//使用set去重数组，但忘记了
		Set<Integer> hashSet = new HashSet<Integer>();

		//保存首位相同的ip
		List<String> list = new ArrayList<String>();


		//遍历数组a中的每一个元素
		for (int i = 0; i < a.length; i++) {
			//去除.
			//String s = a[i].replace(".", "");
			//System.out.println("sss"+s);
			list.add( a[i]);

		}

		//使用Collections的sort方法，并且重写compare方法

		Collections.sort(list);
		for (String string : list) {
			System.out.println(string);
		}



	}
}
